<!--
项目显示
-->
<template>
  <div>
    <el-tag class="tag-item" size="mini" v-if="projects.length>0" v-for="(item,index) in projects" :type="item.color" :key="index">{{item.name}}</el-tag>
  </div>
</template>

<script>
  export default {
    name: 'CompProjectIcons',
    data () {
      return {
       /* projectColorList: {
          RLA: '#ed1c24',
          RLP: '#22b14c',
          RLR: '#ff7f27',
          DMA: '#00a2e8',
          LBM: '#000000'
        },*/
        projectColorList: {
          RLA: 'danger',
          RLP: 'success',
          RLR: 'warning',
          DMA: '',
          LBM: 'info'
        },
      }
    },
    props: ['project'],
    computed: {
      projects: function () {
        if (!this.project) {
          return [];
        }
        let projectArr = [];
        this.project.split('|').forEach(item => {
          projectArr.push({
            name: item,
            color: this.projectColorList[item]
          })
        });
        return projectArr;
      }
    }
  }
</script>
<style lang="scss" scoped>
  .tag-item {
    margin-right: 3px;
  }
</style>
